package com.example.demo.mapper;

import com.example.demo.entity.Upload;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
@Mapper
public interface UploadMapper {
    @Select("select * from upload where name=#{name}")
    List<Upload> findByname(String name);

    @Select("select * from upload where id=#{id}")
    Upload findById(int id);

    @Select("select * from upload")
    List<Upload> findAlll();

    @Select("select * from  upload order by id desc limit 1 ")
    Upload selectLast();

    @Insert("insert into upload(name,uploadTime,state) values (#{name},#{uploadTime},#{state})")
    int register(Upload u);

    @Update("update upload set state=#{state} where id=#{id}")
    int updateUpload(int id,String state);
}
